//
//  DLCollection.h
//  
//
//  Created by Quoc Dung Chu on 22/09/11.
//  Copyright 2011 Paris 6. All rights reserved.
//

#ifndef _DLCollection_h
#define _DLCollection_h

namespace dlab {
    namespace core {

        template <class T>
        class CCollection
        {
        protected:
            int     _size;
            
            virtual void doInsert(T value)  = 0;
            virtual void doClear()  = 0;

            
        public:
            CCollection():_size(0){}
            virtual ~CCollection(){}
            
            int getSize() const { return _size; }
            void insert (T value)
            {
                doInsert(value);
                _size ++;
            }
            
            void clear() const
            {
                doClear();
                _size = 0;
            }
        };
        
        
        template <class T>
        class INode
        {
        protected:
            

            

        public:
            INode(){}
            virtual ~INode(){}
            
        
            virtual T getValue() const = 0;
            virtual void setValue(T value)  = 0;
            
            virtual INode<T> * getPrevious() const = 0;
            virtual void setPrevious (INode<T> * previous) = 0;
            
            virtual INode<T> * getNext() const = 0;
            virtual void setNext (INode<T> * next)  = 0;
            
            virtual INode<T> * getLast() const = 0;
            virtual void setLast (INode<T> * last)  = 0;
            
            virtual void normalize()  = 0;
            virtual void doNormalize() = 0;
            
        };
    }
}

#endif
